<?php

/**
 * Created by PhpStorm.
 * User: Lin
 * Date: 2017/2/13 0013
 * Time: 下午 17:20
 */
/*
 * 登入检测
 */
Class CommonAction extends Action{

    Public function _initialize(){
        if (isset($_SESSION['userId'])&&strtolower(GROUP_NAME)=='index'){

        }else if (isset($_SESSION['uid'])&&strtolower(GROUP_NAME)=='admin'){
//            $notAuth=in_array(MODULE_NAME,explode(',',C('NOT_AUTH_MODULE')))
//                ||in_array(ACTION_NAME,explode(',',C('NOT_AUTH_ACTION')));
            //权限验证
            if(C('USER_AUTH_ON')){
                import('ORG.Util.RBAC');
                RBAC::saveAccessList();//读取权限
                RBAC::AccessDecision(GROUP_NAME)||$this->error('没有权限');
            }
        }else{
            $this->redirect(GROUP_NAME.'/Login/index');
        }
    }

}
